package com.vf.cloud.paas.common.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import lombok.experimental.UtilityClass;

@UtilityClass
public class PasswordUtil {

	public String encoder(String pwd) {
		PasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
		return bCryptPasswordEncoder.encode(pwd);
	}
	
	public boolean matches(CharSequence rawPassword, String encodedPassword) {
		PasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
		return bCryptPasswordEncoder.matches(rawPassword, encodedPassword);
	}
	
}
